/**
 * 我的任务
 *
 * @project sky-take-out_1
 * @author MECHREVO
 * @date 2023/12/15 09:24:55
 * @version 1.0
 */
package com.sky.Task;

import com.sky.webScoket.WebSocketServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

//@Component
@Slf4j
public class MyTask {
    @Autowired
    private WebSocketServer webSocketServer;

    @Scheduled(cron = "*/5 * * * * *")
    public void Task() {
        webSocketServer.sendToAllClient("这是服务端主动推送的消息");
    }
}
